package org.jeecg.modules.demo3.fly.handler;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.reflection.MetaObject;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import java.util.Date;

/**
 * @author wjn
 * @version V1.0
 * @date 2021/1/18 15:30
 * @Copyright © 2021/1/18 深圳卓翼航空无人机有限公司
 */
@Component
@Slf4j
public class TimeHandler implements MetaObjectHandler {

    @Override
    //插入时间的填充策略
    public void insertFill(MetaObject metaObject) {
        //日志输出
        log.info("start insert fill.......");
        this.setFieldValByName("etime",new Date(),metaObject);
        this.setFieldValByName("insertiontime",new Date(),metaObject);
    }

    @Override
    public void updateFill(MetaObject metaObject) {

    }
}
